<template>
	<el-main>
		<el-card shadow="never" header="系统界面设置">
			<el-form ref="form" :model="form" label-width="100px" status-icon>
				<el-form-item label="平台Logo">
					<sc-upload
						v-model="form.logo"
						:apiObj="apiObjLogo"
						title="Logo尺寸100*100"
						:limit="1"
						fit="contain"
					></sc-upload>
				</el-form-item>
				<el-form-item label="平台名称">
					<el-input v-model="form.sysTitle" placeholder="平台名称"></el-input>
				</el-form-item>
				<el-form-item label="登陆主题色">
					<el-color-picker v-model="form.appColor" :predefine="predefineColors"></el-color-picker>
				</el-form-item>
				<el-form-item label="标题主题色">
					<el-color-picker v-model="form.appTitleColor" :predefine="predefineColors"></el-color-picker>
				</el-form-item>
				<el-form-item label="登陆标语">
					<el-input v-model="form.idea" placeholder="登陆标语"></el-input>
				</el-form-item>
				<el-form-item label="技术支持">
					<el-input v-model="form.tecSupport" placeholder="技术支持"></el-input>
				</el-form-item>
				<el-form-item label="系统备案号">
					<el-input v-model="form.recordNumber" placeholder="系统备案号" maxlength="200"></el-input>
				</el-form-item>
				<el-form-item label="界面背景图">
					<sc-upload-multiple
						:apiObj="apiObj"
						v-model="form.backgroundImg" draggable :limit="5" tip="最多上传5个文件,单个文件不要超过10M,请上传图像格式文件"></sc-upload-multiple>
				</el-form-item>
				<el-form-item>
					<el-button type="primary" @click="submit">设置</el-button>
				</el-form-item>
			</el-form>
		</el-card>
	</el-main>
</template>

<script>
export default {
	name: 'Set Theme',
	data() {
		return {
			apiObjLogo:this.$API.file.uploadSysLogo,
			apiObj:this.$API.file.uploadBackGroundImg,
			predefineColors: [
				'#ff4500',
				'#ff8c00',
				'#ffd700',
				'#67C23A',
				'#00ced1',
				'#409EFF',
				'#c71585'
			],
			form: {
				logo:'',
				sysTitle: '',
				idea: '',
				tecSupport: '',
				recordNumber: '',
				backgroundImg: "",
				appColor:'',
				appTitleColor:''
			}
		}
	},
	mounted() {
		this.getSysInterface();
	},
	methods:
		{
			async submit() {
				var res = await this.$API.system.sysInterface.setSysInterface.post(this.form);
				if (res.code == 200) {
					this.$message.success("操作成功")
				} else {
					this.$alert(res.message, "提示", {type: 'error'})
				}
			},
			async getSysInterface() {
				var res = await this.$API.system.sysInterface.getSysInterface.get();
				if (res.code == 200) {
					this.form = res.data;
				} else {
					this.$alert(res.message, "提示", {type: 'error'})
				}
			}
		}
}
</script>

<style>
</style>
